package com.example.demo.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.example.demo.custom.BaseRepository;
import com.example.demo.entity.SysRole;
@Repository
public interface SysRoleRepository extends BaseRepository<SysRole, Integer>{

	@Modifying
	@Query(value="update SysRole t set t.code=?2 where t.code=?1")
	public void changeCode(String oldCode, String newCode);
	
	@Modifying
	@Query(value="update SysRole t set t.name=?2 where t.name=?1")
	public void changeName(String oldName, String newName);

	public List<SysRole> findByParent(SysRole role);
	
	public List<SysRole> findByCode(String code);

}
